﻿// Original author contact info: Owen Emlen (owene_1998@yahoo.com)
// Note: other individuals may also have contributed to this code
// Project hosted on CodePlex.com as of 1/10/2009 at http://wpfimageviewer.codeplex.com
using System;
using System.Linq;
using System.Collections.Specialized;
using System.ComponentModel;
using System.IO;
using BrainTechLLC;
using ImageAppDataModels;
using System.Collections.Generic;
using BrainTechLLC.ThreadSafeObjects;
using BrainTechLLC.WPF;

namespace ImageAppViewModels
{
    public class SpecialFolderHandler : BaseNotifyPropertyChangedUI
    {
        protected SpecialFolderCollection _SpecialFolderCollection;

        public SpecialFolderCollection SpecialFolderCollection
        {
            get { return _SpecialFolderCollection; }
            set
            {
                if (_SpecialFolderCollection != value)
                {
                    // todo - wire up collection changed for child object
                    _SpecialFolderCollection = value;
                    OnPropertyChanged("SpecialFolderCollection");
                }
            }
        }

        public SpecialFolderHandler()
        {
            SpecialFolderCollection = new SpecialFolderCollection();
        }

        public void SaveToSpecialFolder(FileImageViewModel fileImage, SpecialFolder folder)
        {
            if (folder == null)
            {
                if (SpecialFolderCollection.Count == 0)
                {
                    folder = new SpecialFolder() { Name = "Special Folder", Path = "C:\\SpecialFolder" };
                    SpecialFolderCollection.Add(folder);
                }
                else
                {
                    folder = SpecialFolderCollection[0];
                }
            }

            File.Copy(fileImage.FileName, folder.GetDestinationPath(fileImage.FileNameOnly), true);
        }

        public void SaveSpecialFolders()
        {
            // TODO: HEREHERE
        }
    }
}
